home *** CD-ROM | disk | FTP | other *** search
/ Sun Solutions 1997 April to September / Sun Solutions CD - APR '97 - SEP '97 (704-3778-12 Rev. H)(Sun Microsystems, Inc.)(1997).iso / products / bin / httpd / Solaris_x86 / aquery.pl < prev    next >
Perl Script  |  1997-02-26  |  2KB  |  60 lines

  1. #!/bin/sh
  2. perl=/tmp/httpd/.excite/perl
  3. eval "exec $perl -x $0 $1 '$2'"
  4. #!perl
  5.  
  6. ## Copyright (c) 1996 Excite, Inc.
  7. ##
  8. ## This program is a flexible wrapper for the query program. For
  9. ## maximum efficiency, you might want to invoke the executable
  10. ## directly, pointing it to the proper info file with "-C".
  11. BEGIN {
  12.   $root = "/tmp/httpd/.excite";
  13.   unshift(@INC, "$root/perllib");
  14. }
  15.  
  16. require 'architextConf.pl';
  17. require 'os_functions.pl';
  18.  
  19. $database = shift;
  20. die "Must specify database" unless $database;
  21.  
  22. $query = "@ARGV";
  23. if ($query !~ /^\(/) {
  24.     $query = "(concept $query)";
  25. }
  26.  
  27. ## Read the configuration file, and possibly make a CollectionInfo
  28. ## file.
  29. %attr = &ArchitextConf'readConfig("$root/Architext.conf", $database);
  30.  
  31. $attr{'CollectionInfo'} ||
  32.     die "Configuration file must specify CollectionInfo file\n";
  33.  
  34. if (! -e $attr{'CollectionInfo'}) {
  35.     print STDERR "Creating CollectionInfo file '$attr{'CollectionInfo'}'\n";
  36.     &ArchitextConf'makeInfoFile(%attr);
  37.     die "Failed to create CollectionInfo file"
  38.     unless -e $attr{'CollectionInfo'};
  39. }
  40.  
  41. $attr{'SearchExecutable'} ||
  42.     die "Configuration file must specify SearchExecutable\n";
  43.  
  44. $searcher = &ArchitextConf'makeAbsolutePath($attr{'SearchExecutable'},
  45.                         $attr{'ArchitextRoot'});
  46.  
  47. die "SearchExecutable '$searcher' does not exist or is not really exectuable\n"
  48.     if (! &executable($searcher));
  49.  
  50. ## Run the search program now that we have all the options set up.
  51. $qcommand = "$searcher -C $attr{'CollectionInfo'} -q \"$query\"";
  52. $qcommand = &convert_file_names($qcommand);
  53. system($qcommand);
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.